package com.gao.asmdemo

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.gao.asmdemo.chess.Orientation
import com.gao.asmdemo.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {

    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        binding.btn.setOnClickListener{
            binding.aaa.move(Orientation.UP)
        }

        binding.btn2.setOnClickListener {
            binding.aaa.move(Orientation.RIGHT)
        }
        binding.btn3.setOnClickListener {
            binding.aaa.move(Orientation.LEFT)
        }
        binding.btn4.setOnClickListener {
            binding.aaa.move(Orientation.DOWN)
        }
        binding.btn5.setOnClickListener  {
            binding.aaa.reset()
        }
        binding.btn5.setOnLongClickListener {
            binding.aaa.reset()
            false
        }
    }

//    override fun onClick(v: View?) {
//        when(v){
//            binding.btn->{
//                binding.aaa.move(Orientation.UP)
//            }
//
//            binding.btn2->{
//                binding.aaa.move(Orientation.RIGHT)
//            }
//
//            binding.btn3->{
//                binding.aaa.move(Orientation.LEFT)
//            }
//
//            binding.btn4->{
//                binding.aaa.move(Orientation.DOWN)
//            }
//
//            binding.btn5->{
//                binding.aaa.reset()
//            }
//
//        }
//    }

}